package net.lab1024.sa.admin.module.app.api.device;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import net.lab1024.sa.admin.constant.AdminSwaggerTagConst;
import net.lab1024.sa.admin.module.app.api.device.domain.DeviceAddForm;
import net.lab1024.sa.admin.util.AppRequestUtil;
import net.lab1024.sa.base.common.annoation.AppRestController;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.Valid;

/**
 * app 设备管理
 */
@AppRestController
@Tag(name = AdminSwaggerTagConst.App.APP_API_DEVICE)
public class AppDeviceController {

    private final AppDeviceService appDeviceService;

    public AppDeviceController(AppDeviceService appDeviceService) {
        this.appDeviceService = appDeviceService;
    }

    @PostMapping("/device/add")
    @Operation(summary = "添加设备")
    public ResponseDTO<String> add(@Valid @RequestBody DeviceAddForm form) {
        Long userId = AppRequestUtil.getRequestAppUserId();
        return appDeviceService.add(userId, form);
    }

    @GetMapping("/device/detail")
    @Operation(summary = "设备详细信息")
    public ResponseDTO<String> detail() {
        return ResponseDTO.ok();
    }

    @GetMapping("/device/flowWrap")
    @Operation(summary = "流量图")
    public ResponseDTO<String> flowWrap() {
        return ResponseDTO.ok();
    }

    @PostMapping("/device/remove")
    @Operation(summary = "移除设备")
    public ResponseDTO<String> remove() {
        return ResponseDTO.ok();
    }
}
